package ee.maoinvest.frontend.view;

import java.io.IOException;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ViewManager 
{
	private MenuPageEnum menuPageEnum;
	
	public void navigate(String view, HttpServletRequest request, HttpServletResponse response,ServletContext servletContext) 
			throws ServletException, IOException  
	{	
		
		try 
		{
			if (view.equals("login"))
			{
				menuPageEnum = MenuPageEnum.LOGIN_PAGE; 
			}
			
			if (view.equals("mainMenu"))
			{
				menuPageEnum = MenuPageEnum.MAIN_MENU; 
			}
			
//-----------------Administration pages------------------------------------		
			
			if (view.equals("administerElectricityContractsPage"))
			{
				menuPageEnum = MenuPageEnum.ADMINISTER_ELECTRICITY_CONTRACTS_PAGE;
			}
	
			if (view.equals("administerElectricityMetersPage"))
			{
				menuPageEnum = MenuPageEnum.ADMINISTER_ELECTRICITY_METERS_PAGE;
			}
	
			if (view.equals("administerEnterprisesPage"))
			{
				menuPageEnum = MenuPageEnum.ADMINISTER_ENTERPRISES_PAGE;
			}
	
			if (view.equals("administerStatisticsPage"))
			{
				menuPageEnum = MenuPageEnum.ADMINISTER_STATISTICS_PAGE;
			}
	
			if (view.equals("administerSubstationsPage"))
			{
				menuPageEnum = MenuPageEnum.ADMINISTER_SUBSTATIONS_PAGE;
			}
	
			if (view.equals("administerTransformerCoefficentsPage"))
			{
				menuPageEnum = MenuPageEnum.ADMINISTER_TRANSFORMER_COEFFICENTS_PAGE;
			}
		
			if (view.equals("administerEnterpriseRelationsWithElectricityMetersAndContractsPage"))
			{
				menuPageEnum = MenuPageEnum.ADMINISTER_ENTERPRISE_RELATIONS_WITH_ELECTRICITY_METERS_AND_CONTRACTS_PAGE;
			}
			
//-----------------Electricity contract menu subpages------------------------------------			
			
			if (view.equals("allElectricityContractsPage"))
			{
				menuPageEnum = MenuPageEnum.ALL_ELECTRICITY_CONTRACTS_PAGE;
			}
			
			if (view.equals("insertElectricityContractPage"))
			{
				menuPageEnum = MenuPageEnum.INSERT_ELECTRICITY_CONTRACT_PAGE;
			}
			
			if (view.equals("editElectricityContractPage"))
			{
				menuPageEnum = MenuPageEnum.EDIT_ELECTRICITY_CONTRACT_PAGE;
			}
			
			if (view.equals("editElectricityContractChangeContractsWithWhoDisagreesPage"))
			{
				menuPageEnum = MenuPageEnum.EDIT_ELECTRICITY_CONTRACT_CHANGE_CONTRACTS_WITH_WHO_DISAGREES;
			}
			
			if (view.equals("deleteElectricityContractPage"))
			{
				menuPageEnum = MenuPageEnum.DELETE_ELECTRICITY_CONTRACT_PAGE;
			}
			
			if (view.equals("deletingElectricityContractWasSuccessful"))
			{
				menuPageEnum = MenuPageEnum.DELETING_ELECTRICITY_CONTRACT_WAS_SUCCESSFUL;
			}
			
//-----------------Electricity meters menu subpages------------------------------------	
			
			if (view.equals("allElectricityMetersPage"))
			{
				menuPageEnum = MenuPageEnum.ALL_ELECTRICITY_METERS_PAGE;
			}
			//INSERT
			if (view.equals("insertSubstationMainElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.INSERT_SUBSTATION_MAIN_ELECTRICITY_METER_PAGE;
			}
			
			if (view.equals("insertLocalTerritoryElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.INSERT_LOCAL_TERRITORY_ELECTRICITY_METER_PAGE;
			}
			
			if (view.equals("insertOuterTerritoryElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.INSERT_OUTER_TERRITORY_ELECTRICITY_METER_PAGE;
			}
			//EDIT
			if (view.equals("editSubstationMainElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.EDIT_SUBSTATION_MAIN_ELECTRICITY_METER_PAGE;
			}
			
			if (view.equals("editLocalTerritoryElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.EDIT_LOCAL_TERRITORY_ELECTRICITY_METER_PAGE;
			}
			
			if (view.equals("editOuterTerritoryElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.EDIT_OUTER_TERRITORY_ELECTRICITY_METER_PAGE;
			}
			//REPLACE OR EDIT
			if (view.equals("replaceOrDeleteSubstationMainElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.REPLACE_OR_DELETE_SUBSTATION_MAIN_ELECTRICITY_METER_PAGE;
			}
			
			if (view.equals("replaceOrDeleteLocalTerritoryElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.REPLACE_OR_DELETE_LOCAL_TERRITORY_ELECTRICITY_METER_PAGE;
			}
			
			if (view.equals("replaceOrDeleteOuterTerritoryElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.REPLACE_OR_DELETE_OUTER_TERRITORY_ELECTRICITY_METER_PAGE;
			}
			
			

			if (view.equals("changeLocalTerritoryElectricityMeterParentMeterPage"))
			{
				menuPageEnum = MenuPageEnum.CHANGE_LOCAL_TERRITORY_ELECTRICITY_METER_PARENT_METER_PAGE;
			}
			
			
			if (view.equals("deleteElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.DELETE_ELECTRICITY_METER_PAGE;
			}

			
			if (view.equals("replacingOrDeletingLocalTerritoryElectricityMeterFromADatabaseWasSuccessful"))
			{
				menuPageEnum = MenuPageEnum.REPLACING_OR_DELETING_LOCAL_TERRITORY_ELECTRICITY_METER_FROM_A_DATABASE_WAS_SUCCESSFUL;
			}
			
			if (view.equals("replacingOrDeletingSubstationMainElectricityMeterFromADatabaseWasSuccessful"))
			{
				menuPageEnum = MenuPageEnum.REPLACING_OR_DELETING_SUBSTATION_MAIN_ELECTRICITY_METER_FROM_A_DATABASE_WAS_SUCCESSFUL;
			}
			
			if (view.equals("changingLocalTerritoryElectricityMeterParentInADatabaseWasSuccessful"))
			{
				menuPageEnum = MenuPageEnum.CHANGING_LOCAL_TERRITORY_ELECTRICITY_METER_PARENT_IN_A_DATABASE_WAS_SUCCESSFUL;
			}
		
//-----------------Enterprises menu subpages------------------------------------
			if (view.equals("allEnterprisesPage"))
			{
				menuPageEnum = MenuPageEnum.ALL_ENTERPRISES_PAGE;
			}
			
			if (view.equals("insertEnterprisePage"))
			{
				menuPageEnum = MenuPageEnum.INSERT_ENTERPRISE_PAGE;
			}
			
			if (view.equals("editEnterprisePage"))
			{
				menuPageEnum = MenuPageEnum.EDIT_ENTERPRISE_PAGE;
			}
			
			if (view.equals("deleteEnterprisePage"))
			{
				menuPageEnum = MenuPageEnum.DELETE_ENTERPRISE_PAGE;
			}
			
			if (view.equals("deletingEnterpriseWasSuccessful"))
			{
				menuPageEnum = MenuPageEnum.DELETING_ENTERPRISE_WAS_SUCCESSFUL;
			}
			
//-----------------Substations menu subpages------------------------------------
			
			if (view.equals("allSubstationsPage"))
			{
				menuPageEnum = MenuPageEnum.ALL_SUBSTATIONS_PAGE;
			}
			
			if (view.equals("insertSubstationPage"))
			{
				menuPageEnum = MenuPageEnum.INSERT_SUBSTATION_PAGE;
			}
			
			if (view.equals("editSubstationPage"))
			{
				menuPageEnum = MenuPageEnum.EDIT_SUBSTATION_PAGE;
			}
			
			if (view.equals("deleteSubstationPage"))
			{
				menuPageEnum = MenuPageEnum.DELETE_SUBSTATION_PAGE;
			}
			
			if (view.equals("deletingSubstationWasSuccessful"))
			{
				menuPageEnum = MenuPageEnum.DELETING_SUBSTATION_WAS_SUCCESSFUL;
			}
			
//-----------------Transformer coefficents standards menu subpages------------------------------------
			
			if (view.equals("allTransformerCoefficentStandardsPage"))
			{
				menuPageEnum = MenuPageEnum.ALL_TRANSFORMER_COEFFICENT_STANDARDS_PAGE;
			}
			
			if (view.equals("insertTransformerCoefficentStandardPage"))
			{
				menuPageEnum = MenuPageEnum.INSERT_TRANSFORMER_COEFFICENT_STANDARD_PAGE;
			}
			
//-----------------Enterprise relations with electricity meters and contracts coefficents standards menu subpages------------------------------------
			if (view.equals("manageEnterprisesRelationsWithElectricityMetersAndContractsPage"))
			{
				menuPageEnum = MenuPageEnum.MANAGE_ENTERPRISE_RELATIONS_WITH_ELECTRICITY_METERS_AND_CONTRACTS_PAGE;
			}
			
			if (view.equals("manageElectricityContractRelationsWithElectricityMetersAndEnterprisesPage"))
			{
				menuPageEnum = MenuPageEnum.MANAGE_ELECTRICITY_CONTRACT_RELATIONS_WITH_ELECTRICITY_METER_AND_ENTERPRISES_PAGE;
			}
			
			if (view.equals("insertNewContractBetweenEnterpriseAndElectricityMeterPage"))
			{
				menuPageEnum = MenuPageEnum.INSERT_NEW_CONTRACT_BETWEEN_ENTERPRISE_AND_ELECTRICITY_METER_PAGE;
			}
			
//-----------------Statistics -------------------------------------			
			
			if (view.equals("getHelpFindingRegularReadingIDWantedPage"))
			{
				menuPageEnum = MenuPageEnum.GET_HELP_FINDING_REGULAR_READING_ID_WANTED_PAGE;
			}
			
			if (view.equals("getSingleEnterpriseContractPeriodSummaryBetweenRegularReadingsGivenPage"))
			{
				menuPageEnum = MenuPageEnum.GET_SINGLE_ENTERPRISE_CONTRACT_PERIOD_SUMMARY_BETWEEN_REGULAR_READINGS_GIVEN;
			}
			
			if (view.equals("getAllEnterprisesContractPeriodsSummariesBetweenRegularReadingsGivenPage"))
			{
				menuPageEnum = MenuPageEnum.GET_ALL_ENTERPRISES_CONTRACT_PERIODS_SUMMARIES_BETWEEN_REGULAR_READINGS_GIVEN_PAGE;
			}
			
			if (view.equals("getAllEnterprisesContractPeriodsSummariesWhichWereInContractWithSubstationMainElectricityMetersBetweenRegularReadingsGivenPage"))
			{
				menuPageEnum = MenuPageEnum.GET_ALL_ENTERPRISES_CONTRACT_PERIODS_SUMMARIES_WHICH_WERE_IN_CONTRACT_WITH_SUBSTATION_MAIN_ELECTRICITY_METER_BETWEEN_REGULAR_READINGS_GIVEN_PAGE;
			}
			
			if (view.equals("getSpecificParentAndItsChildMetersEnergyConsumptionStatisticsBetweenGivenRegularReadingsPage"))
			{
				menuPageEnum = MenuPageEnum.GET_SPECIFIC_PARENT_AND_ITS_CHILD_METERS_ENERGY_CONSUMPTION_STATISTICS_BETWEEN_GIVEN_REGULAR_READINGS_PAGE;
			}
			
			if (view.equals("getAllEnterprisesEnergyConsumptionAndCostForAccountingPage"))
			{
				menuPageEnum = MenuPageEnum.GET_ALL_ENTERPRISES_ENERGY_CONSUMPTION_AND_COST_FOR_ACCOUNTING_PAGE;
			}
			
//-----------------ERROR PAGES-----------------------------------------------------------
			if (view.equals("errorWithTransformerCoefficentOperationsPage"))
			{
				menuPageEnum = MenuPageEnum.ERROR_WITH_TRANSFORMER_COEFFICENT_OPERATION_PAGE;
			}
			
			if (view.equals("substationErrorPage"))
			{
				menuPageEnum = MenuPageEnum.SUBSTATION_ERROR_PAGE;
			}
			
//-----------------Administer regular readings page -------------------------------------
			if (view.equals("startNewRegularReadingPage"))
			{
				menuPageEnum = MenuPageEnum.START_NEW_REGULAR_READING_PAGE;
			}
			
			if (view.equals("saveElectricityMeterRegularReadingPage"))
			{
				menuPageEnum = MenuPageEnum.SAVE_ELECTRICITY_METER_REGULAR_READING_PAGE;
			}
			
			
			switch (menuPageEnum) 
			{
				case LOGIN_PAGE:  
					servletContext.getRequestDispatcher("/menuElements/login.jsp").forward(request, response);
					break ;
			
				case MAIN_MENU:  
					servletContext.getRequestDispatcher("/menuElements/mainMenu.jsp").forward(request, response);
					break ;
					
//-----------------Administration pages------------------------------------	
				case START_NEW_REGULAR_READING_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerRegularReadings/startNewRegularReading.jsp").forward(request, response);
					break ;
					
				case ADMINISTER_ELECTRICITY_CONTRACTS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityContracts/administerElectricityContracts.jsp").forward(request, response);
					break ;
		
				case ADMINISTER_ELECTRICITY_METERS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/administerElectricityMeters.jsp").forward(request, response);
					break ;
		
				case ADMINISTER_ENTERPRISES_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerEnterprises/administerEnterprises.jsp").forward(request, response);
					break ;
					
				case ADMINISTER_STATISTICS_PAGE:	
					// req.getContextPath() - annab veebirakenduse nime serveril.
					servletContext.getRequestDispatcher("/menuElements/administerStatistics/administerStatistics.jsp").forward(request, response);
					break ;
					
				case ADMINISTER_SUBSTATIONS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerSubstations/administerSubstations.jsp").forward(request, response);					
					break ;
		
				case ADMINISTER_TRANSFORMER_COEFFICENTS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerTransformerCoefficents/administerTransformerCoefficents.jsp").forward(request, response);					
					break ;
					
				case ADMINISTER_ENTERPRISE_RELATIONS_WITH_ELECTRICITY_METERS_AND_CONTRACTS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerEnterpriseRelationsWithElectricityMetersAndContracts/administerEnterpriseRelationsWithElectricityMetersAndContracts.jsp").forward(request, response);					
					break ;	
					
//-----------------Electricity contract menu subpages------------------------------------
					
				case ALL_ELECTRICITY_CONTRACTS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityContracts/allElectricityContracts.jsp").forward(request, response);					
					break ;
				
				case INSERT_ELECTRICITY_CONTRACT_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityContracts/insertElectricityContract.jsp").forward(request, response);					
					break ;
				
				case EDIT_ELECTRICITY_CONTRACT_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityContracts/editElectricityContract.jsp").forward(request, response);					
					break ;
				
				case EDIT_ELECTRICITY_CONTRACT_CHANGE_CONTRACTS_WITH_WHO_DISAGREES:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityContracts/editElectricityContractChangeContractsWithWhoDisagrees.jsp").forward(request, response);					
					break ;
					
				case DELETE_ELECTRICITY_CONTRACT_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityContracts/deleteElectricityContract.jsp").forward(request, response);					
					break ;
					
				case DELETING_ELECTRICITY_CONTRACT_WAS_SUCCESSFUL:				
					response.sendRedirect(request.getContextPath() + "/FrontController?mode=administerElectricityContractsPage&submode=allElectricityContractsPage");
					break ;
					
//-----------------Electricity meters menu subpages------------------------------------	
					
				case ALL_ELECTRICITY_METERS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/allElectricityMeters.jsp").forward(request, response);					
					break ;
					
				case INSERT_SUBSTATION_MAIN_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/insertSubstationMainElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case INSERT_LOCAL_TERRITORY_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/insertLocalTerritoryElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case INSERT_OUTER_TERRITORY_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/insertOuterTerritoryElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case EDIT_SUBSTATION_MAIN_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/editSubstationMainElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case EDIT_LOCAL_TERRITORY_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/editLocalTerritoryElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case EDIT_OUTER_TERRITORY_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/editOuterTerritoryElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case REPLACE_OR_DELETE_SUBSTATION_MAIN_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/replaceOrDeleteSubstationMainElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case REPLACE_OR_DELETE_LOCAL_TERRITORY_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/replaceOrDeleteLocalTerritoryElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case REPLACE_OR_DELETE_OUTER_TERRITORY_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/replaceOrDeleteOuterTerritoryElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case CHANGE_LOCAL_TERRITORY_ELECTRICITY_METER_PARENT_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/changeLocalTerritoryElectricityMeterParentMeter.jsp").forward(request, response);					
					break ;
				
					
				case DELETE_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/deleteElectricityMeter.jsp").forward(request, response);					
					break ;
					
				case ELECTRICITY_METERS_ERROR_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerElectricityMeters/electricityMetersErrorPage.jsp").forward(request, response);					
					break ;
		
				case REPLACING_OR_DELETING_LOCAL_TERRITORY_ELECTRICITY_METER_FROM_A_DATABASE_WAS_SUCCESSFUL:
					response.sendRedirect(request.getContextPath() + "/FrontController?mode=administerElectricityMetersPage&submode=allElectricityMetersPage");					
					break ;
					
				case REPLACING_OR_DELETING_SUBSTATION_MAIN_ELECTRICITY_METER_FROM_A_DATABASE_WAS_SUCCESSFUL:
					response.sendRedirect(request.getContextPath() + "/FrontController?mode=administerElectricityMetersPage&submode=allElectricityMetersPage");				
					break ;
					
				case CHANGING_LOCAL_TERRITORY_ELECTRICITY_METER_PARENT_IN_A_DATABASE_WAS_SUCCESSFUL:
					response.sendRedirect(request.getContextPath() + "/FrontController?mode=administerElectricityMetersPage&submode=allElectricityMetersPage");					
					break ;
					
//-----------------Enterprises menu subpages------------------------------------	
					
				case ALL_ENTERPRISES_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerEnterprises/allEnterprises.jsp").forward(request, response);					
					break ;
					
				case INSERT_ENTERPRISE_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerEnterprises/insertEnterprise.jsp").forward(request, response);					
					break ;
					
				case EDIT_ENTERPRISE_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerEnterprises/editEnterprise.jsp").forward(request, response);					
					break ;
					
				case DELETE_ENTERPRISE_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerEnterprises/deleteEnterprise.jsp").forward(request, response);					
					break ;
					
				case DELETING_ENTERPRISE_WAS_SUCCESSFUL:
					response.sendRedirect(request.getContextPath() + "/FrontController?mode=administerEnterprisesPage&submode=allEnterprisesPage");				
					break ;
					
//-----------------Substation menu subpages------------------------------------
					
				case ALL_SUBSTATIONS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerSubstations/allSubstations.jsp").forward(request, response);					
					break ;
					
				case INSERT_SUBSTATION_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerSubstations/insertSubstation.jsp").forward(request, response);					
					break ;
					
				case EDIT_SUBSTATION_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerSubstations/editSubstation.jsp").forward(request, response);					
					break ;
					
				case DELETE_SUBSTATION_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerSubstations/deleteSubstation.jsp").forward(request, response);					
					break ;
					
				case DELETING_SUBSTATION_WAS_SUCCESSFUL:				
					response.sendRedirect(request.getContextPath() + "/FrontController?mode=administerSubstationsPage&submode=allSubstationsPage");
					break ;	
					
//-----------------Transformer coefficents standards menu subpages------------------------------------
					
				case ALL_TRANSFORMER_COEFFICENT_STANDARDS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerTransformerCoefficents/allTransformerCoefficentStandards.jsp").forward(request, response);					
					break ;
					
				case INSERT_TRANSFORMER_COEFFICENT_STANDARD_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerTransformerCoefficents/insertTransformerCoefficentStandard.jsp").forward(request, response);					
					break ;
					
//-----------------Enterprise relations with electricity meters and contracts menu subpages------------------------------------
					
				case MANAGE_ENTERPRISE_RELATIONS_WITH_ELECTRICITY_METERS_AND_CONTRACTS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerEnterpriseRelationsWithElectricityMetersAndContracts/manageEnterpriseRelationsWithElectricityMetersAndContracts.jsp").forward(request, response);					
					break ;
					
				case MANAGE_ELECTRICITY_CONTRACT_RELATIONS_WITH_ELECTRICITY_METER_AND_ENTERPRISES_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerEnterpriseRelationsWithElectricityMetersAndContracts/manageElectricityContractRelationsWithElectricityMetersAndEnterprises.jsp").forward(request, response);					
					break ;
					
				case INSERT_NEW_CONTRACT_BETWEEN_ENTERPRISE_AND_ELECTRICITY_METER_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerEnterpriseRelationsWithElectricityMetersAndContracts/insertNewContractBetweenEnterpriseAndElectricityMeter.jsp").forward(request, response);					
					break ;
				
//-----------------Statistics-----------------------------------------------------------
				case GET_HELP_FINDING_REGULAR_READING_ID_WANTED_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerStatistics/getHelpFindingRegularReadingIDWanted.jsp").forward(request, response);					
					break ;
					
				case GET_SINGLE_ENTERPRISE_CONTRACT_PERIOD_SUMMARY_BETWEEN_REGULAR_READINGS_GIVEN:
					servletContext.getRequestDispatcher("/menuElements/administerStatistics/getSingleEnterpriseContractPeriodSummaryBetweenRegularReadingsGiven.jsp").forward(request, response);					
					break ;
					
				case GET_ALL_ENTERPRISES_CONTRACT_PERIODS_SUMMARIES_BETWEEN_REGULAR_READINGS_GIVEN_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerStatistics/getAllEnterprisesContractPeriodsSummariesBetweenRegularReadingsGiven.jsp").forward(request, response);					
					break ;
					
				case GET_ALL_ENTERPRISES_CONTRACT_PERIODS_SUMMARIES_WHICH_WERE_IN_CONTRACT_WITH_SUBSTATION_MAIN_ELECTRICITY_METER_BETWEEN_REGULAR_READINGS_GIVEN_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerStatistics/getAllEnterprisesContractPeriodsSummariesWhichWereInContractWithSubstationMainElectricityMetersBetweenRegularReadingsGiven.jsp").forward(request, response);					
					break ;
					
				case GET_SPECIFIC_PARENT_AND_ITS_CHILD_METERS_ENERGY_CONSUMPTION_STATISTICS_BETWEEN_GIVEN_REGULAR_READINGS_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerStatistics/getSpecificParentAndItsChildMetersEnergyConsumptionStatisticsBetweenGivenRegularReadings.jsp").forward(request, response);					
					break ;
				
				case GET_ALL_ENTERPRISES_ENERGY_CONSUMPTION_AND_COST_FOR_ACCOUNTING_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerStatistics/getAllEnterprisesEnergyConsumptionAndCostForAccounting.jsp").forward(request, response);					
					break ;
					
//-----------------ERROR PAGES-----------------------------------------------------------
				
				case ERROR_WITH_TRANSFORMER_COEFFICENT_OPERATION_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerTransformerCoefficents/ErrorWithTransformerCoefficentStandards.jsp").forward(request, response);					
					break ;
					
				case SUBSTATION_ERROR_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerSubstations/substationErrorPage.jsp").forward(request, response);					
					break ;
//-----------------Administer regular readings page -------------------------------------
					
				case SAVE_ELECTRICITY_METER_REGULAR_READING_PAGE:
					servletContext.getRequestDispatcher("/menuElements/administerRegularReadings/saveElectricityMeterRegularReading.jsp").forward(request, response);					
					break ;
					
				default: 
					servletContext.getRequestDispatcher("/menuElements/mainMenu.jsp").forward(request, response);
					break ;
					
			}
		}
		catch (Exception ex) 
		{
			ex.printStackTrace();
		}
	}
}